import React, { Component } from 'react';
import { HashRouter as Router, Route, Switch } from 'react-router-dom'
import Index from './pages/index/Index'
import Cart from './pages/cart/Cart'
import Classify from './pages/classify/Classify'
import My from './pages/my/My'
import Tabbar from './components/tabbar/Tabbar'
import SearchContent from './components/searchContent/searchContent'
import ShopDetail from './pages/shopDetails/ShopDetail'
import ProductList from './pages/productList/ProductList'

class RouterConfig extends Component {
  render() {
    return (
      <Router>
        {/* 首页 */}
        <Route path="/" exact render={
          () => <Tabbar><Index></Index></Tabbar>
        }></Route>
        {/* 购物车 */}
        <Route path="/cart" exact render={
          () => <Tabbar><Cart></Cart></Tabbar>
        }></Route>
        {/* 分类 */}
        <Route path="/classify" exact render={
          () => <Tabbar><Classify></Classify></Tabbar>
        }></Route>
        {/* 我的 */}
        <Route 
        path="/my" exact render={
          () => <Tabbar><My></My></Tabbar>
        }></Route>
        {/* 搜索页面 */}
        <Route 
        path="/searchContent" exact render={
          () => <SearchContent></SearchContent>
        }></Route>
        {/* 商品详情 */}
        <Route 
        path="/shopDetail/:goods_id" exact render={
          (props) => <ShopDetail {...props}></ShopDetail>
        }></Route>
        {/* 商品列表 */}
        <Route 
        path="/productList/:query?" exact render={
          (props) => <ProductList {...props}></ProductList>
        }></Route>
      </Router>
    );
  }
}

export default RouterConfig;